• mynote utils
  • init usage
  • mynote front continuous build *; build.sh & cb.sh obso
  • build 完整自动化
  • add to path env ap.sh
  • auto save; as.sh
  • sf.sh & sfp.sh & ff.sh & rf.sh
  • env.sh
  • force_to_build
  • mynote utils
    E:\uninote\mynote-utils
    E:\uninote\mynote-env-init-v2\utils

    init usage

    git clone git@git.uninote.com.cn:cyb/mynote-utils.git 
    cd mynote-utils/
    # 添加 utils 自身到 PATH 变量
    ./env.sh
    lv1= lv2= type=

    mynote front continuous build *; build.sh & cb.sh obso

    obso by jenkins mynote 
    ref:
    E:\xunwu\im\im-release
    X:\pjkzd\zd_code\p2p-back\build.sh
    cb.sh 循环调用 build.sh(写死了位置依赖关系):
    ./cb.sh master 20
    每个文件(夹)都是单独 cp 的!
    build.sh [build_branch]
    cb.sh branch interval

    build 完整自动化

    注意:
    - dist 的分支需要手动创建。
    - npm 依赖不会自动安装
    # 复制 node 安装文件,并在复制的路径下执行:
    # clone projects
    git clone git@git.uninote.com.cn:cyb/mynote-utils.git  /home/www/mynote-utils
    git clone git@git.uninote.com.cn:collin/mynote-front.git /home/www/front
    git clone git@git.uninote.com.cn:cyb/mynote-front-dist.git /home/www/front/dist
    # nodejs linux 安装 
    yum install xz -y
    tar -xf node-v10.16.3-linux-x64.tar.xz
    mv node-v10.16.3-linux-x64 /usr/node10
    echo 'export PATH=/usr/node10/bin:$PATH' > /etc/profile.d/node.sh
    . /etc/profile.d/node.sh
    # front build
    npm config set registry https://registry.npm.taobao.org
    npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
    cd /home/www/front
    npm install --user=0
    # write default config
    echo '
    module.exports = function (config) {
      config.axios.baseURL = config.proxy["/api"] = "http://127.0.0.1:85/";
      // something
      config.build.extend = function (config, ctx) {
      }
        config.build.extend = function (config, ctx) {
        config.devtool = "source-map";
        // config.devtool = "none";
      }
      config.server.port = 80;
    }
    ' > nuxt.config.my.js
    # cb, eg: cb.sh ttt 2
    cd /home/www/mynote-utils
    ./cb.sh ttt 2

    add to path env ap.sh

    echo 'export PATH=$PATH:'$1 >> /etc/profile.d/env.sh

    auto save; as.sh

    as.sh 用于自动同步
    use:
    E:\uninote\mynote-utils\saves
    # 配合使用
    while ((1)); do git fetch; git reset --hard origin/master; sleep 1; done
    # auto git back dest dir
    dest_dir=$1
    # assume the branch have upstream setup !
    # if not passed, all branch will be pushed !
    push_branch=$2
    lv1= lv2= type=

    sf.sh & sfp.sh & ff.sh & rf.sh

    mynote front 启动/更新 helper
    node node_modules/nuxt/bin/nuxt.js start
    pm2 start node -- node_modules/nuxt/bin/nuxt.js start
    ff -h: (fetch front)
    Usage: ff.sh [<branch-to-fetch>] [<revision-to-reset>]
     branch-to-fetch defaults to current branch
    rf -h: (restart front)
    Usage: rf.sh [<branch-to-fetch>] [<revision-to-reset>]
      branch-to-fetch defaults to current branch
    lv1= lv2= type=

    env.sh

    初始化调用 env.sh 要在 utils 下,因为里面获取的是当前路径。
    # setting env for bash
    path=/etc/profile.d/mynote_utils_env.sh
    echo "export PATH=`pwd`:/usr/node10/bin:/usr/local/nginx/sbin:/usr/local/php/bin:/usr/local/php/sbin:"'$PATH' > $path
    source $path
    lv1= lv2= type=

    force_to_build

    强制重新编译,比如只修改了 nuxt.config.my.js,in front root:
    touch force_to_build